package com.bone.eventsweb.config;
import com.bone.eventsweb.common.JwtInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {


    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor()) //配置jwt的拦截规则
                .addPathPatterns("/**")   //拦截所有的请求路径
                .excludePathPatterns("/eventsweb/user/login");
//                .excludePathPatterns("/eventsweb/navigation/findByPage/1/5")  ; //放行这个请求
        super.addInterceptors(registry);
    }



    @Bean
    public JwtInterceptor jwtInterceptor(){
        return new JwtInterceptor();
    }
}
